package org.batch.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.batch.service.batch.BatchService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 批处理网络接口
 *
 * @author LiKun
 * @date 2021/9/27 10:22
 */
@RestController
@RequestMapping("/batch")
@Api(tags = "批处理相关网络接口")
public class BatchController {
    @Resource
    private BatchService batchService;

    @GetMapping("/jdbc/{account}")
    @ApiOperation(value = "JDBC批处理启动接口", tags = "启动JDBC批处理程序")
    public void csvBatchStart(@PathVariable("account") String account) throws Exception {
        batchService.batchDealTrading(account);
    }

    @GetMapping("/csv")
    @ApiOperation(value = "CSV批处理启动接口", tags = "启动CSV批处理程序")
    public void csvBatchStart(@RequestParam("path") String path, @RequestParam("fields") String fields) throws Exception {
        batchService.batchTradingPersistence(path, fields);
    }
}
